/*
 * ObjectRenderInfo.h
 *
 *  Created on: 06.01.2012
 *      Author: Kirill Blinov
 *      Copyright: LGPL
 */

#ifndef OBJECTRENDERINFO_H_
#define OBJECTRENDERINFO_H_

#include "../BasicTypes.h"

/*
 * Contains game object ( set of 3D models with its world matrixes and bones )
 */
struct SUBOBJECT_WITH_CONTROLLER
{
	SUBOBJECT_WITH_CONTROLLER(){};
	SUBOBJECT_WITH_CONTROLLER( GAME_SUBOBJECT_INSTANCE *Subobject) : subobject(Subobject)
	    {}
	GAME_SUBOBJECT_INSTANCE *subobject;
	CAnimationCollection     controller;
};

class GAME_OBJECT
{
private:
	GAME_OBJECT(){};

	OBJECT_POSITION_DESCRIPTOR positionDescriptor;
	CAnimationCollection       controller;
	UNIT_PHYSIC_PARAMS         physicParams;
public:
	GAME_OBJECT( const UNIT_PHYSIC_PARAMS PhysicParams ): distanceToCamera(0), physicParams(PhysicParams)
	{  };
	virtual ~GAME_OBJECT(){};

	bool      UpdatePhysicParams( const UNIT_PHYSIC_PARAMS &PhysicParams );
	glm::mat4 GetWorldMatrix() const { return positionDescriptor.GetWorldMatrix(); };
	void      Animate( IAnimationPlayer* Player );

	std::vector<SUBOBJECT_WITH_CONTROLLER> models;
	glm::vec3                              firstCorner;
	glm::vec3                              secondCorner;
	glm::vec3                              sphereCenter;
	float                                  sphereRadius;
	float                                  distanceToCamera;
};

#endif /* OBJECTRENDERINFO_H_ */
